from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE IF NOT EXISTS `user` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `userid` INT NOT NULL UNIQUE COMMENT '编号',
    `username` VARCHAR(20) NOT NULL  COMMENT '用户名',
    `password` VARCHAR(60) NOT NULL  COMMENT '密码',
    `disabled` BOOL NOT NULL  COMMENT '禁用' DEFAULT 0,
    KEY `idx_user_userid_f0729d` (`userid`)
) CHARACTER SET utf8mb4;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        DROP TABLE IF EXISTS `user`;"""
